package com.direct.ssh.web.action;

import com.direct.ssh.domain.Customer;
import com.direct.ssh.exception.LoginException;
import com.direct.ssh.service.LoginService;

public class LoginAction extends BaseAction {

	private Customer customer;
	private LoginService loginService; 
	
	public String login() {
		
//		System.out.println("username:" + customer.getUsername());
//		System.out.println("password:" + customer.getPassword());
		
		try {
			
			customer = loginService.login(customer);
			getSession().put("current", customer);
			
		} catch (LoginException e) {
			addActionError("登录失败" + e.getMessage());
		}
		
		
		return SUCCESS;
	}

	
	
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public LoginService getLoginService() {
		return loginService;
	}

	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}
	
}
